package cn.itcast.day02.duotai07;

public class Test {
    public static void main(String[] args) {
        Dog dog =new Dog();
        dog.eat();//gcs
        dog.loolDoor();//看门
        method1(dog);//gcs
        method3(dog);//gcs
        System.out.println("-------------");
        Cat cat =new Cat();
        cat.catmoush();//抓老鼠
        cat.eat();//cy
        method2(cat);//cy
        method3(cat);//cy



    }
    public  static  void  method1(Dog dog){
        dog.eat();
    }
    public  static  void  method2(Cat cat){
        cat.eat();
    }


    public  static  void  method3(Animal animal){
        animal.eat();
       //以下调用子类特有方法报错
        /*Dog dog =(Dog)animal;
        dog.loolDoor();*/

       /* Cat cat =(Cat)animal;
        cat.catmoush();*/
    }
}
